package com.liulei.thinkinginjava;

import net.mindview.util.CountingGenerator;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: Leo
 * Date: 7/7/13
 * Time: 6:50 PM
 * To change this template use File | Settings | File Templates.
 */
public class Test {
    public static void main(String[] args) {
        String[] strArray = {"peter","liulei","xiaoming","xiaoqiang"};
        List<String> stringList = new ArrayList<String>(Arrays.asList(strArray));

        ListIterator<String> listIterator = stringList.listIterator();

        while (listIterator.hasNext()){
            String str = listIterator.next();
            if(str.equals("liulei")){
                listIterator.remove();
                listIterator.add("pengsha");
                System.out.println("text==="+listIterator.next());
                System.out.println("text==="+listIterator.next());
                continue;
            }
            System.out.println(str);
        }

        System.out.println(stringList);
    }
}
